Skip to content

fix: #401 use (SOL) notation to prevent USD/coin amount confusion#402

Closed
nxz1026 wants to merge 2 commits into
profullstack:masterfrom
nxz1026:bounty-401-fix
Closed

fix: #401 use (SOL) notation to prevent USD/coin amount confusion#402
nxz1026 wants to merge 2 commits into
profullstack:masterfrom
nxz1026:bounty-401-fix

Conversation

@nxz1026

@nxz1026 nxz1026 commented Jun 4, 2026

Copy link
Copy Markdown

Bounty Claim: #401

Amount: $1
Repo: profullstack/ugig.net

Problem

When payment_coin is set (e.g. SOL), the bounty display reads "$1.00 USD (paid in SOL)" — readers easily mistake this for "1 SOL" worth ~$1000.

Fix

Changed (paid in SOL)(SOL) with a leading space for proper token separation. Also fixed missing space before coin note in the equal-min/max branch.

  • GigCard.tsx: change (paid in ${coin}) to (${coin}), add space before coin note in equal-min/max case
  • GigCard.test.tsx: add test verifying $1.00 USD (SOL) display

/bounty

@greptile-apps

greptile-apps Bot commented Jun 4, 2026

Copy link
Copy Markdown

Greptile Summary

This PR changes the bounty coin notation from (paid in SOL) to (SOL) to reduce reader confusion between a USD amount and the equivalent coin amount. A test covering the new display format is also added.

  • GigCard.tsx: shortens the coinNote string and attempts to fix a spacing issue in the equal min/max branch, but inadvertently introduces a double space because coinNote already carries its own leading space — the branch now concatenates " " + " (SOL)" yielding " (SOL)".
  • GigCard.test.tsx: adds a valid assertion for the single-space format $1.00 USD (SOL), which would actually fail against the current implementation due to the double-space bug above.

Confidence Score: 3/5

The min===max branch now renders a double space between the USD amount and the coin tag, and the accompanying test would catch this — meaning the test itself would fail when run.

The extra '" " + coinNote' in the equal-budget branch doubles the leading space that coinNote already includes, producing '$1.00 USD (SOL)' instead of '$1.00 USD (SOL)'. The new test asserts the single-space format and would break against this code, so the fix is both functionally wrong and unverified by its own test suite.

src/components/gigs/GigCard.tsx line 80 — the double-space concatenation in the equal min/max branch needs to be corrected before merging.

Important Files Changed

Filename Overview
src/components/gigs/GigCard.tsx Renames coin note from "(paid in SOL)" to "(SOL)", but the min===max branch incorrectly prepends an extra space before coinNote which already carries its own leading space, producing a double-space in the output.
src/components/gigs/GigCard.test.tsx Adds a test for the new (SOL) notation format; the assertion regex is correct but would fail against the current implementation due to the double-space bug in GigCard.tsx.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[getBudgetDisplay] --> B{budget_type === revenue_share?}
    B -- yes --> C[return rev share string]
    B -- no --> D{min && max && min !== max?}
    D -- yes --> E["fmt(min) - fmt(max) + suffix + coinNote"]
    D -- no --> F{min && max?}
    F -- yes --> G["fmt(min) + suffix + ' ' + coinNote ⚠️ double space"]
    F -- no --> H{min only?}
    H -- yes --> I["fmt(min)+ + suffix + coinNote"]
    H -- no --> J{max only?}
    J -- yes --> K["up to fmt(max) + suffix + coinNote"]
    J -- no --> L[Budget TBD / Rate TBD]

    style G fill:#f88,stroke:#c00,color:#000
Loading

Reviews (1): Last reviewed commit: "fix: apply DeepSeek review suggestions —..." | Re-trigger Greptile


if (min && max && min !== max) return `${fmt(min)} - ${fmt(max)}${suffix}${!isSats ? coinNote : ""}`;
if (min && max) return `${fmt(min)}${suffix}${!isSats ? coinNote : ""}`;
if (min && max) return `${fmt(min)}${suffix}${!isSats ? " " + coinNote : ""}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Double space in equal min/max branch

coinNote is already defined with a leading space ( (${coin})), so prepending " " + coinNote yields " (SOL)" — two spaces — for the min === max path. The rendered text becomes $1.00 USD (SOL) instead of $1.00 USD (SOL). The new test asserts the single-space pattern /\$1\.00 USD \(SOL\)/ and would fail with this implementation.

Suggested change
if (min && max) return `${fmt(min)}${suffix}${!isSats ? " " + coinNote : ""}`;
if (min && max) return `${fmt(min)}${suffix}${!isSats ? coinNote : ""}`;

Comment on lines +63 to +65
// Use ~ prefix when paying in crypto so readers don't mistake USD value for coin amount
// e.g. "$1.00 USD (~SOL)" not "$1.00 USD (paid in SOL)" — ~ makes it clear it's an equivalent
const coinNote = coin ? ` (${coin})` : "";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The comment says the format uses a ~ prefix (e.g., "$1.00 USD (~SOL)"), but the code produces (SOL) without any tilde. The comment misleads future readers about the actual output format.

Suggested change
// Use ~ prefix when paying in crypto so readers don't mistake USD value for coin amount
// e.g. "$1.00 USD (~SOL)" not "$1.00 USD (paid in SOL)" — ~ makes it clear it's an equivalent
const coinNote = coin ? ` (${coin})` : "";
// Append "(COIN)" so readers don't mistake the USD value for a coin amount
// e.g. "$1.00 USD (SOL)" not "$1.00 USD (paid in SOL)"
const coinNote = coin ? ` (${coin})` : "";

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

poster: mockPoster,
};
render(<GigCard gig={gig} />);
// Should show "$1.00 USD (SOL)" not "$1.00 USD (paid in SOL)" — (SOL) not (~SOL)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The inline comment says (SOL) not (~SOL) but the code comments in GigCard.tsx state the opposite — that ~ prefix is used. With the stale ~ comment removed from the source, the test comment should simply describe the expected format clearly.

Suggested change
// Should show "$1.00 USD (SOL)" not "$1.00 USD (paid in SOL)" — (SOL) not (~SOL)
// Should show "$1.00 USD (SOL)" not "$1.00 USD (paid in SOL)"

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@nxz1026

nxz1026 commented Jun 5, 2026

Copy link
Copy Markdown
Author

fixed

@nxz1026 nxz1026 closed this Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant